﻿<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="sysModuleList.aspx.cs" Inherits="mydddd.sysModule.List" %>

<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
    <title></title>
</head>

<body>
    <form id="form1" runat="server">
        <f:PageManager ID="PageManager1" AutoSizePanelID="RegionPanel1" runat="server" />



        <f:RegionPanel ID="RegionPanel1" ShowBorder="false" runat="server" >
            <Regions>

                <f:Region ID="Region2" RegionSplit="true" Width="200px"
                    ShowHeader="false"
                    EnableCollapse="true" Layout="Fit" RegionPosition="Left" runat="server">
                    <Items>

                        <f:Tree ID="Tree1" Width="650px" EnableCollapse="true" ShowHeader="true" Title="页面菜单(右键功能操作)" runat="server" OnNodeCheck="Tree1_OnNodeCheck">
                            <Nodes>
                               
                            </Nodes>
                            <Listeners>
                                <f:Listener Event="containercontextmenu" Handler="function (grid, e, eOpts) { e.stopEvent(); F('containerMenu').showAt(e.getXY()); }" />
                                <%--<f:Listener Event="itemcontextmenu" Handler="function (view, record, item, index, e) { e.stopEvent(); F('itemMenu').showAt(e.getXY()); }" />--%>
                                    <f:Listener Event="itemcontextmenu" Handler="function (view, record, item, index, e) { e.stopEvent(); F('itemMenu').showAt(e.getXY());setPid(record.data.id); }" />
                            </Listeners>
                        </f:Tree>

                    </Items>
                </f:Region>

                <f:Region ID="mainRegion" ShowHeader="false" Position="Center"
                    runat="server" Layout="Fit">

                    <Items>

                        <f:Grid ID="Grid1" runat="server" Title="Grid" AllowPaging="True" AllowSorting="True" SortDirection="asc" SortField="sort"
                            EnableCheckBoxSelect="true" AutoScroll="True" DataKeyNames="id" EnableTextSelection="True" CheckBoxSelectOnly="True"
                            IsDatabasePaging="True" ShowHeader="False" OnPageIndexChange="Grid1_OnPageIndexChange">

                            <PageItems>
                                <f:ToolbarSeparator  runat="server" />

                                <f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数：" />

                                <f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlPageSize_OnSelectedIndexChanged">
                                    <f:ListItem Text="10" Value="10" />
                                    <f:ListItem Text="20" Value="20" />
                                    <f:ListItem Text="50" Value="50" Selected="True" />
                                    <f:ListItem Text="100" Value="100" />
                                </f:DropDownList>
                                <f:ToolbarSeparator runat="server" />
                                <f:Button ID="Button_delete" runat="server" Icon="Delete"
                                    ConfirmText="确定要执行选中行操作吗？" Text="批量删除" OnClick="Button_delete_OnClick">
                                </f:Button>
                            </PageItems>
                            <Columns>
                                <f:WindowField ColumnID="editField" TextAlign="Center" Icon="Pencil" ToolTip="编辑" HeaderText="编辑"
                                    WindowID="Window1" Title="编辑" DataIFrameUrlFields="ID" DataIFrameUrlFormatString="sysModuleAdd.aspx?id={0}"
                                    Width="50px" />

                                <f:BoundField runat="server" DataField="id" HeaderText="id" Width="35px" />

                                <f:TemplateField runat="server" Width="45px" HeaderText="父id">
                                    <ItemTemplate>
                                        <%#Eval("parentID") %>
                                    </ItemTemplate>
                                </f:TemplateField>

                                <f:TemplateField runat="server" Width="100px" HeaderText="页面名称">
                                    <ItemTemplate>
                                        <%#Eval("moduleName") %>
                                    </ItemTemplate>
                                </f:TemplateField>

                                <f:TemplateField runat="server" Width="150px" HeaderText="路径">
                                    <ItemTemplate>
                                        <%#Eval("modulePath") %>
                                    </ItemTemplate>
                                </f:TemplateField>

                                <f:TemplateField runat="server" Width="270px" HeaderText="URL地址">
                                    <ItemTemplate>
                                        <%#Eval("moduleUrl") %>
                                    </ItemTemplate>
                                </f:TemplateField>

                                <f:TemplateField runat="server" Width="50px" HeaderText="图标">
                                    <ItemTemplate>
                                        <a href="javascript:<%#Window1.GetShowReference("SetIcon.aspx?id=" +Eval("id"),"修改图标") %>">
                                            <%#Eval("moduleIcon").ToString().Length>0?("<img src='../../"+Eval("moduleIcon").ToString()+"?"+DateTime.Now.ToString("fff")+"'/> "):"无"%>
                                        </a>
                                    </ItemTemplate>
                                </f:TemplateField>

                                <f:TemplateField runat="server" Width="50px" HeaderText="排序">
                                    <ItemTemplate>
                                        <%#Eval("sort") %>
                                    </ItemTemplate>
                                </f:TemplateField>

                                <f:CheckBoxField Width="80px" RenderAsStaticField="true" DataField="status" HeaderText="是否显示" />
                                <f:CheckBoxField Width="80px" RenderAsStaticField="true" DataField="isend" HeaderText="最子节点" />
                                
                                <f:TemplateField runat="server" Width="100px" HeaderText="备注信息" ExpandUnusedSpace="True">
                                    <ItemTemplate>
                                        <%#Eval("info") %>
                                    </ItemTemplate>
                                </f:TemplateField>

                            </Columns>
                        </f:Grid>

                    </Items>

                </f:Region>
            </Regions>
        </f:RegionPanel>
        <f:Menu ID="containerMenu" runat="server" ClientIDMode="Static" Hidden="True">
            <f:MenuButton runat="server" ID="btn_add" Icon="Add" Text="添加" EnablePostBack="False" OnClientClick="addTree(0);"></f:MenuButton>
            <f:MenuSeparator runat="server" />
            <f:MenuButton runat="server" Icon="Reload" Text="刷新" OnClientClick="location.reload();"></f:MenuButton>
        </f:Menu>
        <f:Menu ID="itemMenu" runat="server" ClientIDMode="Static" Hidden="True">
            <f:MenuButton runat="server" ID="MenuButton1" Icon="Add" Text="添加子节点" EnablePostBack="False" OnClientClick="addTree(F('hd_pid').getValue());"></f:MenuButton>
            <f:MenuButton runat="server" ID="btn_edit" Icon="Pencil" Text="修改" EnablePostBack="False" OnClientClick="editTree(F('hd_pid').getValue());"></f:MenuButton>
          <%--  <f:MenuButton runat="server" ID="btn_del" Icon="Delete" Text="删除" OnClick="btn_del_OnClick"></f:MenuButton>--%>
            <f:MenuSeparator runat="server" />
            <f:MenuButton runat="server" Icon="Reload" Text="刷新" OnClientClick="location.reload();"></f:MenuButton>
        </f:Menu>
        <f:Window ID="Window1" runat="server" Height="450px" Width="650px" IsModal="true" EnableMaximize="True"
            CloseAction="HidePostBack" EnableIFrame="True" Hidden="True" Icon="ApplicationFormEdit" OnClose="Window1_OnClose"
            Target="Top" EnableResize="True">
        </f:Window>
        <f:HiddenField runat="server" ID="hd_pid" ClientIDMode="Static"/>
    </form>
</body>
</html>
<script>
    //中转值
    function setPid(pid) {
        //alert(pid);
        F('hd_pid').setValue(pid);
    }

    function addTree(pid) {
        //alert(pid);
        F('Window1').f_show("/admin/sysModule/sysModuleAdd.aspx?pid=" + pid, "添加页面组件");
    }

    function editTree(id) {
        //alert(id);
        F('Window1').f_show("/admin/sysModule/sysModuleAdd.aspx?id=" + id, "编辑页面组件");
    }
</script>
